$(function() {
                 
    $("#painel-login").dialog({
        title:"SGLj - Login de acesso",
        closeOnEscape: false,
        open: function(){
            $(".ui-dialog-titlebar-close").hide();
                      
            $('.ui-dialog-buttonpane').find('button:contains("Entrar")').button({
                icons: {
                    primary: 'ui-icon-circle-check'
                }
            });
        },
        autoOpen: true,
        resizable: false,
        modal: true,
        buttons: {
            "Entrar": function() {                
                loading(true);               
                    $.post("autenticar", {
                    'user.password' : $("#senha").val(),
                    'user.email' : $("#email").val()
                }, function(response){
                    loading(false);
                    if(response.success === true) {
                        location.href = "painel.jsp";
                    } else {
                        alert(response.message);
                    }
                });                
            }
        }
    });
});


